
<script type="text/javascript">

$(document).ready(function(){

	//$(".product_line").$("#")
	$("#add").click( function(){
		$.get("http://application.dev:8001/Cart/cart/addline/order/703/", getList);
	});

	$("#substract").click( function(){
		$.get("http://application.dev:8001/Cart/cart/addline/order/703/quantity/-1/",getList);
	});		
});	

function restarProduct( id )
{
	$.get("http://application.dev:8001/Cart/cart/addline/order/703/quantity/-1/",getList);
}

function agregarProduct( id )
{
	$.get("http://application.dev:8001/Cart/cart/addline/order/703/quantity/1/",getList);
}

function getList(data)
{
	$('#result').html(data);

}

</script>
<h3>Orden <?=$this->orderId?></h3>

<div id="result">
	<table >
		<tr>
			<th>Articulo</th>
			<th>Cantidad</th>
			<th>Descuento</th>
			<th>Subtotal</th>
			<th>Eliminar</th>
		</tr>
		<?php  foreach( $this->lines as $line  ): ?>
		<!-- 
			sales_line_id = <?=$line->sales_line_id?>
			sales_order_id = <?=$line->sales_order_id?>
			product_id = <?=$line->product_id?>
			product_type = <?=$line->product_type?>
			product_description = <?=$line->product_description?>
			product_detail = <?=$line->product_detail?>
			ordered_quantity = <?=$line->ordered_quantity?>
			unit_selling_price = <?=$line->unit_selling_price?>
			unit_shipping_price = <?=$line->unit_shipping_price?>
			unit_final_price = <?=$line->unit_final_price?>
			line_order = <?=$line->line_order?>
			pcnt_tax = <?=$line->pcnt_tax?>
		 -->
		<tr class="product_line" id="product_line_<?=$line->sales_line_id?>">
			<td><?=$line->product_description?></td>
			<td><?=$line->ordered_quantity?></td>
			<td>0</td>
			<td><?=$line->unit_selling_price?></td>
			<td>x</td>
			<td><span class="clickable" onclick="agregarProduct(<?=$line->sales_line_id?>);">Agregar</span></td>
			<td><span class="clickable" onclick="restarProduct(<?=$line->sales_line_id?>);">Restar</span></td>
		</tr>
		<?php endforeach;?>
								<tr>
			<td colspan="6">Total<?=''?></td>
		
		</tr>
		
	</table>
</div>	

